package com.lym.order.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 第三方API 天气接口远程调用客户端
 */
//@FeignClient(name = "weather-client", url = "http://aliv18.data.moji.com")
@FeignClient(name = "weather-client", url = "http://weatherapi-ts.xiangtatech.com")
public interface WeaterFeignClient {

    /**
     * 天气接口
     * 备注: 这里使用的是阿里云平台墨迹天气服务
     *
     * @return
     */
    @PostMapping("/whapi/json/alicityweather/condition")
    String getWeather(@RequestHeader("Authorization") String authorization,
                      @RequestParam("token") String token,
                      @RequestParam("cityId") String cityId);

    /**
     * 天气接口 2
     *
     * 浏览器直接访问:
     * http://weatherapi-ts.xiangtatech.com/api/GetAssistData?type=1&province=安徽&city=合肥
     *
     * @return
     */
    @GetMapping("/api/GetAssistData")
    String getWeather2(@RequestParam("type") String type,
                      @RequestParam("province") String province,
                      @RequestParam("city") String city);

}
